// 冒泡排序算法 bubbling sort
// http://c.biancheng.net/view/6506.html


#include <bits/stdc++.h>
using namespace std;

#define DEBUG_
#ifdef DEBUG_
#define PF(...) printf(__VA_ARGS__)
#else
#define PF(...)
#endif

class Solution {
public:
    int bubble_sort(vector<int>& nums, int k) {
        for(int i = 0; i < nums.size(); i++) {
            for (int j = 0; j + 1 < nums.size() - i; j++) {
                if (nums[j] > nums[j+1]) {
                    swap(nums[j], nums[j+1]);
                }
            }
        }
    }
};

int main() {
  Solution sol;
  vector<int> nums = {1,5,4,9,4,-2,-4,6};
  sol.bubble_sort(nums,15);
  for (auto nn : nums) PF("%d,", nn);
  PF("\n");
  return 0;
}

